﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZHDJ.Data;
using ZHDJ.Data.Models.Common;
using ZHDJ.Data.Models.Org;
using ZHDJ.WebPage;
using PageBase = AppBox.BLL.PageBase;

namespace AppBox.admin
{
    public partial class _default : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        #region 绑定数据
        private void BindData()
        {
            lblUserName.Text = CurrentUser.UserName;
            var branchResult = PartyOrgBranch.GetBranchBId(CurrentUser.BranchID ?? "");
            if (branchResult.Rows.Count > 0) {
                lblWorkUnit.Text = branchResult.Rows[0]["BranchName"].ToString();
            }
            
            lblIntegral.Text = string.Format("我的积分：{0}", PartyObjectScore.SumMemberintegral("Member", CurrentUser.LoginID).ToString());
            liRank.Text = string.Format("总排名：{0}", PartyObjectScore.GetRankingByObjectID("Member", CurrentUser.LoginID).ToString());
            liBranch.Text = string.Format("组织内排名：{0}", PartyObjectScore.GetRankingByObjectID("Member", CurrentUser.LoginID, CurrentUser.BranchID));
            imgLogo.ImageUrl = UpFileBusiness.GetFileUrl(CurrentUser.ImageUrl);
        }
        #endregion

    }
}
